<!--
 * @Author: 张辰龙 zhangchenlong@julimeng.com
 * @Date: 2025-06-12 11:23:58
 * @LastEditors: 张辰龙 zhangchenlong@julimeng.com
 * @LastEditTime: 2025-06-25 10:45:37
 * @FilePath: /managehub-admin-web/src/views/article/videoData/hotVideo/components/detail.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
    <div>
        <el-dialog :visible.sync="dialogVisible" width="640px" title="视频预览" @close="handleCancel">
            <div v-if="dialogVisible">
                <div v-loading="loading" id="video-container"></div>
            </div>
        </el-dialog>
    </div>
</template>

<script>
import { getPlayAuth } from "@/api/hotVideo";
export default {
    data() {
        return {
            dialogVisible: false,
            detailInfo: {},
            loading: false,
            noProdUrl: "https://julimeng-prod.oss-cn-hangzhou.aliyuncs.com/managehub/static/volcengine/volc-vod-web-veplayer-noprod.lic",
            prodUrl: 'https://julimeng-prod.oss-cn-hangzhou.aliyuncs.com/managehub/static/volcengine/volc-vod-web-veplayer-prod.lic'
        }
    },

    methods: {
        handleUpload() {
        },
        openlog(v) {
            this.dialogVisible = true
            this.$nextTick(() => {
                this.getDetail(v)
            })
        },
        handleCancel() {
            this.dialogVisible = false
        },
        getDetail(v) {
            this.detailInfo = v
            this.loading = true
            getPlayAuth({ vid: v.vid }).then(res => {
                this.initVideo(res.data)
            })
        },

        initVideo(token) {
            VePlayer.setLicenseConfig({
                license: process.env.NODE_ENV ==  'production' ? this.prodUrl : this.noProdUrl
            })
            const playerSdk = new VePlayer({
                "id": "video-container",
                "streamType": "mp4",
                "getVideoByToken": {
                    "playAuthToken": token
                },
                "width": 600,
                "height": 400,
                "autoplay": true,
                "loop": true,
                "fluid": false,
                "vodLogOpts": {
                    "vtype": "MP4",
                    "tag": "普通视频",
                    "line_app_id": process.env.NODE_ENV ==  'production' ? 778753 : 781272,
                    "line_user_id": "veplayer_web_demo"
                }
            });
            this.loading = false
        }
    },
}
</script>

<style></style>